#include <iostream>
using namespace std;

class base
{
public:
    base(int size)
    {
        // 分配多块空间
        p = new int[size]{10, 20, 30, 40, 50, 60, 70};
        // 初始化成员
        this->size = size;
    }
    base(base &t)
    {
        // 拷贝空间
        this->p = new int[t.size];
        // 初始化成员
        this->size = t.size;
        // 深拷贝
        for (int i = 0; i < this->size; i++)
        {
            this->p[i] = t.p[i];
        }
    }
    void show()
    {
        for (int i = 0; i < size; i++)
        {
            cout << p[i] << " ";
        }
        cout << endl;
                cout << p << endl;
    }
    ~base()
    {
        delete[] p; // 释放堆空间
    }

private:
    int *p;
    int size;
};

int main()
{
    base tmp(10);
    tmp.show();

    base tmp1 = tmp;
    tmp1.show();
}  